# -*- coding: utf-8 -*-
#
# File: CgiIRCIntegration.py
#
# Copyright (c) 2009 by ['Izhar Firdaus']
# Generator: ArchGenXML Version 2.3
#            http://plone.org/products/archgenxml
#
# GNU General Public License (GPL)
#

__author__ = """Izhar Firdaus <unknown>"""
__docformat__ = 'plaintext'

from AccessControl import ClassSecurityInfo
from Products.Archetypes.atapi import *
from zope.interface import implements
import interfaces

from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin

from Products.ATContentTypes.content.link import ATLink
from Products.ATContentTypes.content.link import ATLinkSchema
from Products.OCFExternalIntegration.config import *
import random

##code-section module-header #fill in your manual code here
##/code-section module-header

copied_fields = {}
copied_fields['remoteUrl'] = ATLinkSchema['remoteUrl'].copy()
copied_fields['remoteUrl'].widget.label = "CgiIRC script URL"
schema = Schema((

    StringField(
        name='channel',
        widget=StringField._properties['widget'](
            label='Channel',
            label_msgid='OCFExternalIntegration_label_channel',
            i18n_domain='OCFExternalIntegration',
        ),
    ),
    StringField(
        name='server',
        widget=StringField._properties['widget'](
            label='Server',
            label_msgid='OCFExternalIntegration_label_server',
            i18n_domain='OCFExternalIntegration',
        ),
    ),
    copied_fields['remoteUrl'],


),
)

##code-section after-local-schema #fill in your manual code here
##/code-section after-local-schema

CgiIRCIntegration_schema = ATLinkSchema.copy() + \
    schema.copy()

##code-section after-schema #fill in your manual code here
##/code-section after-schema

class CgiIRCIntegration(ATLink):
    """
    """
    security = ClassSecurityInfo()

    implements(interfaces.ICgiIRCIntegration)

    meta_type = 'CgiIRCIntegration'
    _at_rename_after_creation = True

    schema = CgiIRCIntegration_schema

    ##code-section class-header #fill in your manual code here
    ##/code-section class-header

    # Methods
    def getRemoteUrl(self):
        return self.absolute_url()

    def randomNick(self):
        return "CgiIRC%s" % random.randint(100,999)
        


registerType(CgiIRCIntegration, PROJECTNAME)
# end of class CgiIRCIntegration

##code-section module-footer #fill in your manual code here
##/code-section module-footer



